<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	<!-- imports -->
	<script language="JavaScript" src="../js/FrageHinzufuegen.js"></script>
	<!-- imports -->
	<rich:popupPanel id="questionDetail" autosized="true" modal="true" moveable="true" show="#{QuestionViewBean.showInnerComp}">
		<f:facet name="header"><center>Question Detail</center></f:facet>
		<center><h:outputLabel value="Frage ändern/löschen" styleClass="ueberschrift"/></center>
		<h:form id="QuestionChange">
		<table id="frage_hinzufuegen_table" class="standart kontoverwaltung">
			<tr>
				<td>Frage:</td>
				<td><h:inputTextarea readonly="#{!QuestionViewBean.canAccessAll()}"  cols="80" rows="7" value="#{QuestionViewBean.questionTextChange}" maxlength="255" id="frage_text"/></td>
			</tr>
			<tr>
				<td>Fragetyp:</td>
				<td>
				<rich:select disabled="#{!QuestionViewBean.canAccessAll()}" value="#{QuestionViewBean.questionTypeChange}" hideNoSelectionOption="true">
					<f:selectItems value="#{QuestionViewBean.questionTypeListForNewQuestion}"/>
					<a4j:ajax execute="QuestionChangeAdd" event="selectitem" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" render="questionAnswerchoice"/>
				</rich:select>
				</td>
			</tr>
			<tr>
				<td></td>
				<td><center>
					<rich:panel id="questionAnswerchoice" styleClass="newQuestionAnswerChoicePanel" style="#{QuestionViewBean.showAnswerChoice}">
						<center><rich:pickList disabled="#{!QuestionViewBean.canAccessAll()}" value="#{QuestionViewBean.selectedAnswers}" sourceCaption="Available Answers" targetCaption="Selected Answers" listWidth="130px" listHeight="100px" orderable="false">
                			<f:selectItems value="#{QuestionViewBean.notselectedAnswers}" var="answer"  itemValue="#{answer}" itemLabel="#{answer.text}" />
           		 			<f:converter converterId="AnswerPossibilityConverter" />
           		 		</rich:pickList></center>
           		 		<hr width="80%" style="margin:5px;"/>
           		 		<a4j:commandButton value="neue Antwortmöglichkeit" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();#{rich:component('addAnswerPossibility_change')}.show();"/>
					</rich:panel></center>
				</td>
			</tr>
			<tr>
				<td><center><a4j:commandButton id="saveChangedQuestion" disabled="#{!QuestionViewBean.canAccessAll()}" action="#{QuestionViewBean.ChangeQuestion()}" execute="QuestionChange" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" value="speichern" render="Messagespopup questionTableForm QuestionChange"/></center></td>
				<td><center><a4j:commandButton id="deleteQuestion" disabled="#{!sessionManagerBean.userinfo.user.benutzerrolle.bezeichnung.equals('Administrator')}" action="#{QuestionViewBean.deleteQuestion()}" execute="QuestionChange" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();#{rich:component('questionDetail')}.hide();" value="löschen" render="Messagespopup questionTableForm"/></center></td>
				<td><center><a4j:commandButton action="#{QuestionViewBean.hideInnerComp()}" execute="@this" onclick="#{rich:component('questionDetail')}.hide();" value="abbrechen"/></center></td>
			</tr>
		</table>
		</h:form>
		
		<rich:panel styleClass="newQuestionAnswerChoiceDetailPanel">
		<f:facet name="header">Detail</f:facet>
		<h:inputTextarea id="answerChoiceDetail_change" style="width: 100%;" readonly="true"/>
		</rich:panel>
		
		<rich:popupPanel id="addAnswerPossibility_change" autosized="true">
			<f:facet name="header"><center>neue Antwortmöglichkeit</center></f:facet>
		<h:form id="newAnswerpossibility">
			<table id="Antwortmoeglichkeit_hinzufuegen_table" class="standart kontoverwaltung">
			<tr>
				<td>Antwortmöglichkeit:</td>
				<td><h:inputTextarea  cols="80" rows="7" value="#{QuestionViewBean.newAnswerPossibility}" maxlength="255"/></td>
			</tr>
			<tr>
				<td><center><a4j:commandButton action="#{QuestionViewBean.createNewAnswerPossibility()}" oncomplete="#{rich:component('addAnswerPossibility_change')}.hide();" execute="newAnswerpossibility" render="Messagespopup QuestionChange" value="speichern"/></center></td>
				<td><center><a4j:commandButton  onclick="#{rich:component('addAnswerPossibility_change')}.hide();" value="abbrechen"/></center></td>
			</tr>
			</table>
		</h:form>
		</rich:popupPanel>		
		</rich:popupPanel>												
</ui:composition>